#include "mcl/str.h"

/* overall application functions */
mcl_str_t*    mcl_str_cat(mcl_str_t *dest, const char *src){
   mcl_str_t* temp=mcl_str(src);
   //FIXME: check if string was successfully alloc
   dest=mcl_str_cat_z(dest, temp);
   mcl_str_free(temp);
   return dest;
}
mcl_str_t*    mcl_str_sub_c(const char *src, int from, int length){
   mcl_str_t* temp=mcl_str(src);
   //FIXME: check if string was successfully alloc
   mcl_str_t* dest=mcl_str_sub_cz(temp, from, length);
   mcl_str_free(temp);
   return dest;
}
mcl_str_t* mcl_str_insert(mcl_str_t* str, const char* section, int start, int length){
   mcl_str_t* temp=mcl_str(section);
   //FIXME: check if string was successfully alloc
   str=mcl_str_insert_z(str, temp, start, length);
   mcl_str_free(temp);
   return str;
}
mcl_str_t* mcl_str_replace(mcl_str_t* str, const char *which, const char *what){
   mcl_str_t* temp=mcl_str(what);
   //FIXME: check if string was successfully alloc
   str=mcl_str_replace_z(str, which, temp);
   mcl_str_free(temp);
   return str;
}
mcl_str_t* mcl_str_match_delete(mcl_str_t* str, const char *which){
   return mcl_str_replace(str, which, "");
}
